<template>
  <div class="Showcase1">
    <div class="Showcase1-top">
      <div
        class="titile-box"
        v-for="(item, index) in props.list"
        :key="index"
        :style="{ left: `${ShowcaseItemTransform(item.x ? item.x : getParentX(Number(index)), item.width, 1.533)}rem` }"
      >
        <p>{{ item.name }}</p>
      </div>
      <img
        class="Showcase1-top-left"
        :src="publicUrls + 'free/style8/ShowcaseTopleft.webp'"
        alt=""
      />
      <div class="Showcase1-top-center">
        <img :src="publicUrls + 'free/style8/ShowcaseTopcon.webp'" alt="" />
      </div>
      <img
        class="Showcase1-top-right"
        :src="publicUrls + 'free/style8/ShowcaseTopRight.webp'"
        alt=""
      />
    </div>
    <div class="Showcase1-center">
      <img
        class="Showcase1-center-center"
        :src="publicUrls + 'free/style8/ShowcaseCenLeft.webp'"
        alt=""
      />
      <div class="Showcase2-center-center"></div>
      <img
        class="Showcase1-center-right"
        :src="publicUrls + 'free/style8/ShowcaseCenRight.webp'"
        alt=""
      />
    </div>
    <div class="Showcase1-btm">
      <img
        class="Showcase1-btm-left"
        :src="publicUrls + 'free/style8/ShowcaseBtmLeft.webp'"
        alt=""
      />
      <img
        class="Showcase1-btm-con"
        :src="publicUrls + 'free/style8/ShowcaseBtmCon.webp'"
        alt=""
      />
      <img
        class="Showcase1-btm-right"
        :src="publicUrls + 'free/style8/ShowcaseBtmRight.webp'"
        alt=""
      />
    </div>
    <div class="inverted">
      <img :src="publicUrls + 'free/style8/ShowcaseInverted1.webp'" alt="" class="left" />
      <div class="content"></div>
      <img :src="publicUrls + 'free/style8/ShowcaseInverted3.webp'" alt="" class="right" />
    </div>
  </div>
</template>   

<script lang="ts">
export default defineComponent({
  name: 'free8Style1',
});
</script>
  
<script setup lang="ts">
import { publicUrls } from '@/utils/minxin';
import { ShowcaseItemTransform } from '@/utils/setmaterialStyle';
import { defineComponent } from 'vue';
const props = defineProps({
  list: {
    type: Object,
  },
});

const getParentX = (indexs: number) => {
  let x = 0;
  for (let index = 0; index < indexs; index++) {
    // const element = array[index];
    x = x + props.list[index].width;
  }
  return x + 0.1;
};
</script>  

<style scoped lang="less">
.Showcase1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 300px;
  height: 100%;
  position: relative;
  .inverted {
    position: absolute;
    bottom: -236px;
    left: 50%;
    transform: translate(-50%, 0);
    width: calc(100% - 45px);
    height: 293px;
    display: flex;
    z-index: -1;
    img {
      object-fit: contain;
    }
    .left {
      width: 118px;
      height: 100%;
    }
    .content {
      width: 100%;
      height: 68px;
      flex-shrink: 1;
      min-width: 164px;
      margin-top: 22px;
      background: url('https://static.jiyi.show/free/style8/ShowcaseInverted2.webp') center/100%
        100%;
    }
    .right {
      width: 118px;
      height: 100%;
    }
  }
}
.Showcase1-top {
  display: flex;
  height: 152px;
  width: calc(100% - 45px);
  .titile-box {
    width: 220px;
    height: 40px;
    background: url(https://static.jiyi.show/free/style8/Showcase1titleBg.webp) no-repeat center /
      cover;
    padding: 6px 20px;
    position: absolute;
    top: 74px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    p {
      // width: 16px;
      // width: 100%;
      width: 100%;
      color: #fff;
      line-height: 40px;
      font-size: 18px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-family: SourceHanSerifCN-Bold;
      text-align: center;
    }
  }

  .Showcase1-top-left {
    width: 124px;
    height: 100%;
  }
  .Showcase1-top-center {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 178px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .Showcase1-top-right {
    width: 98px;
    height: 100%;
  }
}
.Showcase1-center {
  display: flex;
  width: calc(100% - 45px);
  height: 100%;
  min-height: 30px;
  .Showcase1-center-center {
    width: 124px;
    height: 100%;
    flex-shrink: 0;
  }
  .Showcase2-center-center {
    width: 100%;
    min-width: 178px;
  }
  .Showcase1-center-right {
    width: 98px;
    height: 100%;
    flex-shrink: 0;
  }
}
.Showcase1-btm {
  height: 88px;
  width: calc(100% - 45px);
  display: flex;
  .Showcase1-btm-left {
    width: 124px;
    height: 100%;
  }
  .Showcase1-btm-con {
    width: 100%;
    min-width: 158px;
  }
  .Showcase1-btm-right {
    width: 118px;
    height: 100%;
  }
}
</style>